Pendam

ShaileshPendam

Shailesh Pendam | Sr.Software Engineer

How to Create an APNs Apple Push Notification Service Certificate.

Posted on May 20, 2021

by Shailesh Pendam

To generate an Apple ios Push Notification Service (APNS) certificate, follow these steps.

The first step to generate (APNS) certificate is to generate a certificate request (CSR) file from MacBook key-chain.

step 1:

  open Key-chain from your Mac system.

step 2:

  Navigate to  Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority... to create a SSL certificate.

Mountain

step 2:

In the Certificate Information section enter the following details:

User Email Address , friendlyName > save to Disk

Mountain

click on Continue.

step 3: Save As pop Change the file name extension in the Save As field to .CSR and click Save

Mountain

step 3:

Generate a Development/Production Certificate

Login to Apple developer account and click Certificates, Identifiers and Profiles.

Mountain

Select Certificates in your Apple Developer Account.

Mountain

and click on > plus button.

Select Apple Push Notification service SSL (Sandbox & Production) for the type and click Continue.

Mountain

Select the App ID (also known as Bundle ID) of your app and click Continue.

Mountain

Upload a Certificate Signing Request To manually generate a Certificate, you need a Certificate Signing Request (CSR) file from your Mac. we already save in step 2.

Mountain

Click Continue.

Download the resulting certificate.

Install the Certificate and Private Key

Install both the certificate and the private key on your provider server. In macOS, double-clicking the certificate installs it in Keychain Access automatically. If you created your CSR file from your provider server, Keychain Access installs the key in your keychain automatically.

Convert the .cer File to a .p12 Certificate

steps >

Open the .cer file you downloaded; it will open Keychain Access.

Select your certificate, right-click, and export your certificate in a .p12 format.

APNS Certificate/ PEM file

Follow the below steps to convert the APNS certificate obtained in the previous step to .pem file.

steps >

First, go to Keychain Access and select your APNS certificate, then right-click on it select Export option. Now export your certificate in .p12 format. You will be prompted to provide a password for .p12, do the same.

Convert the .p12 file obtained in the previous step into a .pem file. Now the most difficult part - open “Terminal” on your Mac, and run the following commands:

cd
cd Desktop
openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys
openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes